package com.zzr.demo.redis.controller;

import com.zzr.demo.redis.service.MessageQueueService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: xiaomi
 * @date: 2021/10/11
 * @description:
 */
@RestController
@RequestMapping("mq/stream")
@Api(tags = "消息队列：使用 Stream 实现")
@Slf4j
public class MessageQueueByStreamController {

    @Autowired
    MessageQueueService messageQueueService;

    @GetMapping("/addMessage/{key}/{value}")
    @ApiOperation("初始化限速器")
    public String addMessage(@PathVariable("key") String key, @PathVariable("value") String value) {
        String recordId = messageQueueService.addMessage(key, value);
        return recordId;
    }
    

}
